<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>

<head>
    <meta charset="UTF-8">
    <title>房屋租赁系统</title>
    <link rel="stylesheet" type="text/css" href="css/common.css"/>
    <link rel="stylesheet" type="text/css" href="css/main.css"/>
    <script type="text/javascript" src="js/libs/modernizr.min.js"></script>
    <script type="text/javascript" src="js/jquery-2.1.1.min.js"></script>
    <script type="text/javascript" src="js/jquery.validate.min.js"></script>

    <style>
        .error {
            font-size: 13px;
            color: red;
        }
        .result-wrap{
            border-bottom: none;
        }
    </style>
    <script type="text/javascript">
        $().ready(function () {
            // 在键盘按下并释放及提交后验证提交表单
            $("#myform").validate({

                rules: {
                    password: {
                        required: true,
                    },

                    password1: {
                        required: true,
                        minlength: 6,
                        maxlength: 12

                    },
                    password2: {
                        required: true,
                        minlength: 6,
                        maxlength: 12,
                        equalTo: "#password1"
                    }

                },
                messages: {
                    password: {
                        required: "原密码不能为空"
                    },

                    password1: {
                        required: "密码不能为空",
                        minlength: "不能小于6个字符",
                        maxlength: "不能大于12个字符"

                    },
                    password2: {
                        required: "请再次输入确认",
                        minlength: "不能小于6个字符",
                        maxlength: "不能大于12个字符",
                        equalTo: "两次输入的密码不一致！"

                    }

                }
            });
        })
    </script>

</head>
<body>

<div class="result-title">
    <h1>修改密码</h1>
</div>
<div class="result-content">
    <div class="sidebar-title">
        <form action="/user/update.action" method="post" id="myform" name="myform"
              enctype="multipart/form-data">
            <table class="insert-tab" width="100%">
                <tbody>
                <input type="hidden" name="id" value="${sessionScope.user.id}"/>
                <tr>
                    <th><i class="require-red"></i>账号：</th>
                    <td>
                        <input class="common-text required" value="${sessionScope.user.username}"
                               id="username"
                               name="username" size="50" type="text">
                    </td>
                </tr>
                <tr>
                    <th><i class="require-red">*</i>原密码：</th>
                    <td>
                        <input class="common-text required" id="password" name="password" size="50"
                               type="password">
                    </td>
                </tr>
                <tr>
                    <th><i class="require-red">*</i>新密码：</th>
                    <td>
                        <input class="common-text required" id="password1" name="password1"
                               size="50" type="password">
                    </td>
                </tr>
                <tr>
                    <th><i class="require-red">*</i>确认新密码：</th>
                    <td>
                        <input class="common-text required" id="password2" name="password2"
                               size="50" type="password">
                    </td>
                </tr>
                <tr>
                    <th></th>
                    <td>
                        <input class="btn btn-primary btn6 mr10" value="提交" type="submit">
                        <input class="btn btn6" onclick="history.go(-1)" value="返回" type="button">
                    </td>
                </tr>
                <tr>
                    <font id="error" color="red">${msg}</font>
                </tr>
                </tbody>
            </table>
        </form>
    </div>
</div>

</body>
</html>